<?php
/**
 * Created by PhpStorm.
 * User: adminstrator
 * Date: 2018/2/8
 * Time: 16:35
 */
header("Content-type:text/html;charset=utf-8");
date_default_timezone_set('PRC');
include_once("./Db_pdo.class1.php");
 echo '<pre>';
$DB1=new Db_pdo("newcxh","admin","2018126");

// $oldata=$DB1->table("fx_user")->field('pid,uid')->select();
// file_put_contents('fx_user.txt',serialize($oldata));


// $sql = 'select us.*,fx.lv as lves from cxh_users as us left join fx_user as fx on fx.uid = us.user_id';
// $cxhusers = $DB1->new_query($sql);
// $cxhusers = $cxhusers->fetchAll(PDO::FETCH_ASSOC);  
// file_put_contents('cxh_users.txt',serialize($cxhusers));


// //测试
// // $tsetsql = 'select us.*,fx.lv as lves from cxh_users as us left join fx_user as fx on fx.uid = us.user_id where us.user_id=2388';
// // $testcxhusers = $DB1->new_query($tsetsql);
// // $testcxhusers = $testcxhusers->fetchAll(PDO::FETCH_ASSOC);  
// // file_put_contents('testcxhusers.txt',serialize($testcxhusers));


// //车辆补贴申请总额的判断
//  $buying = $DB1->table("buying")->field('*')->select();
//  file_put_contents('buying.txt',serialize($buying));

// //门票补贴
//  $ticket = $DB1->table("ticket")->field('*')->select();
//   file_put_contents('tickets.txt',serialize($ticket));
// // print_r($ticket);

// // 代理商申请总表
//  $agent = $DB1->table("agent")->field('*')->select();
//  file_put_contents('agent.txt',serialize($agent));

// //
//  $pass_agent = $DB1->table("agent")->field('*')->where('agent_state = 1')->select();
//  file_put_contents('pass_agent.txt',serialize($pass_agent));

//  $service = $DB1->table("service")->field('*')->select();
//  file_put_contents('service.txt',serialize($service));
 
// //这里截断


// // //计算门票返款天数
// $sql1 = 'select count(1) as num,user_id   from back_buy WHERE `status`=2  GROUP BY user_id';

// $ticket_day = $DB1->new_query($sql1);
// $ticket_day = $ticket_day->fetchAll(PDO::FETCH_ASSOC);  
// // print_r($ticket_day);
// file_put_contents('ticket_day.txt',serialize($ticket_day));




















// $sql = 'select us.*,fx.lv as lves from cxh_users as us left join fx_user as fx on fx.uid = us.user_id';
// $cxhusers = $DB1->new_query($sql);
// $cxhusers = $cxhusers->fetchAll(PDO::FETCH_ASSOC);  

// print_r($cxhusers);
// $car_sql = 'select count(1) as days,sum(pay_back) as money,sum(no_back) as no_money from back_buy where status=0 group by buying_id limit 999999';



// $csql = $DB1->new_query($car_sql);
// $car_buy = $csql->fetchAll(PDO::FETCH_ASSOC);  
// echo '<pre>';
// print_r($car_buy);






//对账 
// $sql = '';

// $arr =array();

// $data = unserialize(file_get_contents('cz.txt'));
// // print_r($data);
// foreach ($data as $key => $value) {
// 	$sql = 'SELECT user_id,pay_points FROM cxh_users where user_id='.$value['member_id'];
// 	$csql = $DB1->new_query($sql);
// 	$car_buy = $csql->fetchAll(PDO::FETCH_ASSOC);  

// 	$param = $value;
// 	$param['pay_points'] = $car_buy[0]['pay_points'];
// 	$param['jc'] = $car_buy[0]['pay_points']-$value['uch_money'];
// 	$arr[] =$param;

// }
// print_r($arr);









